<?php

require_once(dirname(__FILE__).'/../conf/conf.php');
require_once(dirname(__FILE__).'/database/DB.php');


// STAND ALONE MODIFICATION HACK for DB class.

if ( ! defined('BASEPATH')) 
	define('BASEPATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);

define('EXT', '.php');

function show_error($msg) { echo $msg; }

function log_message($level, $msg) { 
	/* empty echo */ 
	if (SY_DEBUG == TRUE)
		echo 'log: ['.$level.'] <span style="color: red;">'.$msg.'</span><br/>';
}

if (function_exists(display_error) == FALSE)
{
	function display_error($error = '', $swap = '', $native = FALSE) { 
		if (SY_DEBUG == TRUE)
			echo 'error: ' . print_r($error, TRUE);
	}
}

// END

$db_connector;

function get_database_connector_instance( $_db = NULL )
{
	global $db, $active_group;
	
	if ( $_db != NULL ) 
	{
		$db_connector = DB( $_db );
	}
	else
	{
		$db_connector = DB( $db[$active_group] );
	}
	
	return $db_connector;
}

function reconnect()
{
	GLOBAL $db_connector;
	$db_connector->reconnect();
}

?>